package cn.com.xjnt.vas.manage.domain.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "sys_dict_data")
@NamedQuery(name = "DictData.findAll", query = "SELECT d FROM DictData d")
public class DictData extends com.frameworks.core.entity.IdEntity {
	private static final long serialVersionUID = 1L;

	@Column(nullable = false, length = 60)
	private String name;

	@Column(nullable = false, length = 60)
	private String code;

	@Column(nullable = false)
	private int priority;

	@Temporal(TemporalType.TIMESTAMP)
	private Date createDate;

	@Temporal(TemporalType.TIMESTAMP)
	private Date modifyDate;

	@ManyToOne
	@JoinColumn(name = "classify_id", nullable = false)
	private DictClassify dictClassify;

	public DictData() {
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getModifyDate() {
		return modifyDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}

	public DictClassify getDictClassify() {
		return dictClassify;
	}

	public void setDictClassify(DictClassify dictClassify) {
		this.dictClassify = dictClassify;
	}

	@PrePersist
	public void onCreate() {
		this.createDate = this.modifyDate = new Date();
	}

	@PreUpdate
	public void onUpdate() {
		this.modifyDate = new Date();
	}
}